home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Utilities / Remotes / Source / Prefs.m < prev    next >
Encoding:
Text File  |  1992-09-23  |  4.8 KB  |  159 lines

  1. /*---------------------------------------------------------------------------
  2. Prefs.m -- Copyright (c) 1991 Rex Pruess
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 1, or (at your option)
  7.    any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or send
  17.    electronic mail to the the author.
  18.  
  19. This routine loads & displays the preferences window.  It also contains the
  20. methods for handling the user requests generated from within the preferences
  21. window.
  22.  
  23. Rex Pruess <rpruess@umaxc.weeg.uiowa.edu>
  24.  
  25. $Header: /rpruess/apps/Remotes3.0/RCS/Prefs.m,v 3.0 92/09/23 22:15:27 rpruess Exp $
  26. -----------------------------------------------------------------------------
  27. $Log:    Prefs.m,v $
  28. Revision 3.0  92/09/23  22:15:27  rpruess
  29. Checked in to RCS to get the revision number updated to 3.0.
  30.  
  31. Revision 2.1  92/09/23  21:29:58  rpruess
  32. Updated code for NeXT System Release 3.0.
  33.  
  34. Revision 2.0  91/01/22  15:34:05  rpruess
  35. Remotes-2.0 was upgraded for NeXT System Release 2.0 (standard or extended).
  36. Remotes-2.0 supports the NeXT supplied Terminal application and the Stuart
  37. shareware product.
  38.  
  39. Revision 1.1  90/04/10  14:27:18  rpruess
  40. Initial revision
  41.  
  42. -----------------------------------------------------------------------------*/
  43.  
  44. /* Standard C header files */
  45. #include <libc.h>
  46. #include <stdio.h>
  47.  
  48. /* Prefs class header files */
  49. #import "Prefs.h"
  50. #import "HostListManager.h"
  51.  
  52. /* Appkit header files */
  53. #import <appkit/Application.h>
  54. #import <appkit/Form.h>
  55. #import <appkit/Matrix.h>
  56. #import <appkit/Window.h>
  57.  
  58. @implementation Prefs
  59.  
  60. - init
  61. {
  62.    self = [super init];
  63.    [NXApp loadNibSection:"Prefs.nib" owner:self withNames:NO];
  64.    [prefsWindow setMiniwindowIcon:"app"];
  65.  
  66.    return self;
  67. }
  68.  
  69. /*---------------------------------------------------------------------------
  70. Initialize the fields in the preferences window.
  71. -----------------------------------------------------------------------------*/
  72. - initPrefs:sender
  73. {
  74.    /* Set debugging matrix value. */
  75.    [debugMatrix selectCellWithTag:[theHLM getDebugLevel:self]];
  76.    
  77.    /* Insert config pathname & position cursur to it in the prefs window. */
  78.    [configForm setStringValue:[theHLM getConfigFile:self]];
  79.    [configForm selectTextAt:0];
  80.  
  81.    return self;
  82. }
  83.  
  84. /*---------------------------------------------------------------------------
  85. The user pressed the menu revert button.
  86. -----------------------------------------------------------------------------*/
  87. - menuRevert:sender
  88. {
  89.    if ([prefsWindow isKeyWindow] == YES)
  90.       [self prefsRevert:self];
  91.    
  92.    return self;
  93. }
  94.  
  95. /*---------------------------------------------------------------------------
  96. Revert the fields in the preference's window.
  97. -----------------------------------------------------------------------------*/
  98. - prefsRevert:sender
  99. {
  100.    [debugMatrix selectCellWithTag:[theHLM getDebugLevel:sender]];
  101.  
  102.    [configForm setStringValue:[theHLM getConfigFile:self]];
  103.    [configForm selectTextAt:0];
  104.    return self;
  105.    return self;
  106. }
  107.  
  108. /*---------------------------------------------------------------------------
  109. Set new values from those specified in the preferences window.
  110. -----------------------------------------------------------------------------*/
  111. - prefsSet:sender
  112. {
  113.    [configForm selectTextAt:0];
  114.    [theHLM setDebugLevel:[[debugMatrix selectedCell] tag]];
  115.    [theHLM setConfigFile:[configForm stringValueAt:0]];
  116.    return self;
  117. }
  118.  
  119. /*---------------------------------------------------------------------------
  120. Display the preferences window.
  121. -----------------------------------------------------------------------------*/
  122. - showPrefsWindow:sender
  123. {
  124.    [prefsWindow makeKeyAndOrderFront:sender];
  125.    return self;
  126. }
  127.  
  128. /*---------------------------------------------------------------------------
  129. Establish the outlets.
  130. -----------------------------------------------------------------------------*/
  131. - setConfigForm:anObject
  132. {
  133.    configForm = anObject;
  134.    return self;
  135. }
  136.  
  137. - setDebugMatrix:anObject
  138. {
  139.    debugMatrix = anObject;
  140.    return self;
  141. }
  142.  
  143. - setPrefsWindow:anObject
  144. {
  145.    prefsWindow = anObject;
  146.    return self;
  147. }
  148.  
  149. /*---------------------------------------------------------------------------
  150. Message from Remotes.m results in the execution of this set.
  151. -----------------------------------------------------------------------------*/
  152. - setHLM:anObject
  153. {
  154.    theHLM = anObject;
  155.    return self;
  156. }
  157.  
  158. @end
  159.